/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webService;

import api.Beans.UserLogin;
import api.SessionBeans.TCloudServiceRemote;
import api.action.ActionPackageClient;
import api.action.ActionPackageServer;
import api.exception.TCloudAplicationException;
import api.localModel.LocalFileStatus;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author Tomas
 */
@WebService(serviceName = "TcloudWebService")
@Stateless()
public class TcloudWebService {
    @EJB
    private TCloudServiceRemote ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "uploadChanges")
    public void uploadChanges(@WebParam(name = "actionPackage") ActionPackageServer actionPackage) throws TCloudAplicationException {
        ejbRef.uploadChanges(actionPackage);
    }

    @WebMethod(operationName = "isUpdate")
    public boolean isUpdate(@WebParam(name = "userId") long userId, @WebParam(name = "accHeaderVersion") int accHeaderVersion) {
        return ejbRef.isUpdate(userId, accHeaderVersion);
    }

    @WebMethod(operationName = "downloadUpdateActions")
    public ActionPackageClient downloadUpdateActions(@WebParam(name = "localStatus") LocalFileStatus localStatus) {
        return ejbRef.downloadUpdateActions(localStatus);
    }

    @WebMethod(operationName = "loginUser")
    public UserLogin loginUser(@WebParam(name = "userName") String userName, @WebParam(name = "password") String password) {
        return ejbRef.loginUser(userName, password);
    }
    
}
